package com.zues.java_test.crud;

import com.zues.java_test.crud.domain.Student;
import com.zues.java_test.crud.method.CrudService;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName Demo1
 * @Description crud通用性方法测试
 * @Author zeus
 * @Date 3/7/2025 4:14 下午
 * @Version 1.0
 **/
public class Demo1 {

    @Test
    void test1() throws IllegalAccessException {
        List<Student> currentStudents = new ArrayList<>();
        currentStudents.add(new Student(1, "小明", 1));
        currentStudents.add(new Student(2, "小李", 1));
        currentStudents.add(new Student(3, "小刘", 1));

        List<Student> updateStudents = new ArrayList<>();
        updateStudents.add(new Student(1, "小明", 1));
        updateStudents.add(new Student(3, "小刘2", 1));
        updateStudents.add(new Student(4, "小王", 1));

        CrudService crudService = new CrudService();

        crudService.updateList(currentStudents, updateStudents, student -> student.getSort() == 1);

        for (Student student : currentStudents) {
            System.out.println(student);
        }


    }

}
